package com.imooc.mapping.course3.copier;

import com.imooc.mapping.course3.DateMapper;
import com.imooc.mapping.course3.Metadata;
import com.imooc.mapping.course3.TDataCenterMetadata;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * @Author Tim
 * @Description:
 * @Version 1.0
 *
 *
 * 数据类型转化
 */
@Mapper(uses = DateMapper.class)
public interface MetadataCopier {
    @Mapping(source = "createTime", target = "createTime", dateFormat = "yyyy/MM/dd HH:mm:ss")
    @Mapping(source = "priceMax", target = "priceMax", numberFormat = "#.##E0")
    @Mapping(source = "price", target = "price", numberFormat = "$#.00")
    Metadata metadataCopier(TDataCenterMetadata metadata);

    MetadataCopier INSTANCE = Mappers.getMapper(MetadataCopier.class);
    //1000 , $1000.00
}
